// xc_lshop/savemoney/recharge/com/phone.js
Component({
  options: {
    addGlobalClass: true,
    multipleSlots: true
  },
  /**
   * 组件的属性列表
   */
  properties: {
    config:Object
  },

  /**
   * 组件的初始数据
   */
  data: {
    keyval:"1",
    nav:[
      {name:"移动",key:"1"},
      {name:"联通",key:"2"},
      {name:"电信",key:"3"},
 
    ],
    phone:"",
    cardnum:"",
    itemindex:-1,
    checked:false
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onClickNav(e){
      this.setData({
        keyval:e.currentTarget.dataset.val
      })
      this.chuanzhi("type",e.currentTarget.dataset.val)
    },
    inputtext(e){
     

      this.chuanzhi("number",e.detail)
    },
    cardnuminputtext(e){
      this.chuanzhi("card",e.detail)

    },
    // onChange(e){

    //   var val=!this.data.checked
    //   this.setData({
    //     checked:val
    //   })
    //   this.chuanzhi("ischecked",val)
      
    // },
    choosePrice(e){
      var dataset=e.currentTarget.dataset;
      this.setData({
        itemindex:dataset.index
      })
      this.chuanzhi("item",dataset.item)
    },
    chuanzhi(name,data){
      var data={
        name:name,
        data:data
      }
      this.triggerEvent('chuanzhi', data, {})
    }
  }
})
